<?php

class document_page extends base_layout {

    /** CONSTRUCTOR
     *  @param $pageTitle: title of the page
     *  @param $pageDescription: description of the page
     *  @param $pageKeywords: keywords for this page
     *  @param string $TPLfile: path to tpl file
     *  @param string|array $cssLink: contains multiple or single link(s) to css
     *  @param string|array $jsLink: contains multiple or single link(s) to js
     *  @param array $smartyVars: array contains initial smarty variables ($key => $value form)
     */
    public function __construct($pageTitle, $pageDescription, $pageKeywords, $TPLfile = null, $cssLink = null, $jsLink = null, $smartyVars = null) {
        parent::__construct($TPLfile, $cssLink, $jsLink, $smartyVars);

        if (!is_string($pageTitle))       $pageTitle       = strval($pageTitle);
        if (!is_string($pageDescription)) $pageDescription = strval($pageDescription);
        if (!is_string($pageKeywords))    $pageKeywords    = strval($pageKeywords);

        $this->_smartyVars["page"] = array(
            "title"         => $pageTitle,
            "description"   => $pageDescription,
            "keywords"      => $pageKeywords
        );
    }

    /** merge all the needed variables of this object to smarty variables
     */
    public function buildingAllSmartyVars() {
        $this->_smartyVars = array_merge_recursive($this->_smartyVars,
            array("page" => array(
                    "css"   => $this->_css,
                    "js"    => $this->_js,
                    "tpl"   => $this->_tpl_list
                )
            )
        );
    }
}

?>